from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCN_DRG

def group(record):
  adrg_zd=["C52.x00","C53.100","C53.900","C54.100","C55.x00","C56.x00","C56.x00x003","C57.000","C79.600","D06.000","D06.100","D06.900","D06.900x002","D07.200x002","D25.000","D25.000x002","D25.100x001","D25.100x002","D25.200","D25.200x002","D25.900","D25.900x001","D25.901","D26.000","D26.100x002","D26.900","D27.x00","D28.202","D39.100x003","D39.101","D39.200x001","N71.901","N71.902","N72.x00x003","N73.003","N73.300","N80.000","N80.001","N80.100","N80.100x001","N80.302","N80.900","N81.101","N81.200","N81.201","N81.202","N81.300","N81.301","N81.400","N81.601","N81.802","N83.201","N83.202","N83.502","N84.001","N84.100","N85.000","N85.001","N85.002","N85.003","N85.101","N87.001","N87.002","N87.100","N87.101","N87.901","N93.801","N93.901","N95.000","Q51.100","Q51.803","Q51.900","Q52.800x004","T83.305"]
  adrg_zd1=[]
  adrg_ss=["54.4x10","68.0x00x006","68.2400","68.2500x001","68.3100x002","68.3102","68.3104","68.3901","68.3902","68.3904","68.3905","68.3906","68.4100","68.4101","68.4102","68.4900x006","68.4901","68.4902","68.4903","68.5100x005","68.5101","68.5102","68.5900x002","68.5900x003","68.5901","68.6100x001","68.6101","68.6900x001","68.6900x002","68.6901","68.7100x001","68.7900x003"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合NC1入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCN_DRG.NC19_group(record):
      return 'NC19'

    return 'NC1'
  else:
    return ''

